package com.xlh.controller.conclude;


import com.xlh.common.Result;
import com.xlh.service.conclude.ConcludeStatisticsService;
import com.xlh.vo.conclude.ConcludeScoreCheckVO;
import com.xlh.vo.conclude.CourseStatisticVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "ConcludeStatisticsController", description = "工程认证 - 统计类")
@RestController
@RequestMapping("/conclude/statistics")
public class ConcludeStatisticsController {

    @Autowired
    private ConcludeStatisticsService concludeStatisticsService;


    @ApiOperation("课程目标达成度分析")
    @GetMapping("/course")
    @PreAuthorize("@permissionValidator.isTeacher()")
    public Result statisticsCourse(@RequestParam("concludeId") Long concludeId){

        List<CourseStatisticVO> result = concludeStatisticsService.statisticsCourse(concludeId);
        return Result.success(result);
    }


    @ApiOperation("各个分数段的学生人数")
    @GetMapping("/studentcount")
    @PreAuthorize("@permissionValidator.isTeacher()")
    public Result studentCount(@RequestParam("concludeId") Long concludeId){

        List<List<Integer>> result = concludeStatisticsService.studentCount(concludeId);
        return Result.success(result);
    }


}
